//
//  DKAuthSecurityView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/29.
//

#import "DKAuthSecurityView.h"

@implementation DKAuthSecurityView
-(instancetype)init{
    if(self == [super init]){
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    UIImageView * dk_AuthSecurityImgView = [[UIImageView alloc] init];
    dk_AuthSecurityImgView.userInteractionEnabled = YES;
    dk_AuthSecurityImgView.image = DK_GetImage(@"dk_AuthSecurity");
    [self addSubview:dk_AuthSecurityImgView];
    [dk_AuthSecurityImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(@(DK_IsWidthScale(0)));
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.width.equalTo(@(DK_IsWidthScale(14)));
        make.height.equalTo(@(DK_IsWidthScale(16)));
    }];
    UILabel * dk_AuthSecurityLab = [[UILabel alloc] init];
    dk_AuthSecurityLab.textColor = DK_Hex(@"#4566FF");
    dk_AuthSecurityLab.text = @"Security";
    dk_AuthSecurityLab.font = DK_FONT_Medium(12);
    [self addSubview:dk_AuthSecurityLab];
    [dk_AuthSecurityLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_AuthSecurityImgView.mas_right).offset(DK_IsWidthScale(7));
        make.right.equalTo(@(DK_IsWidthScale(0)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
    UIButton * dk_AuthSecurityBtn = [[UIButton alloc] init];
    [dk_AuthSecurityBtn addTarget:self action:@selector(authSecurity) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:dk_AuthSecurityBtn];
    [dk_AuthSecurityBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_AuthSecurityImgView);
        make.right.equalTo(@(DK_IsWidthScale(0)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
}
- (void)authSecurity{
    if(self.CheckSecurityBlock){
        self.CheckSecurityBlock();
    }
}
@end
